{extends file="../global.html"}
{block name=body}
<p class="bg-success">
 <a href="javascript:history.go(-1)" class="btn btn-info" title=" "> <i class="glyphicon glyphicon-backward"> </i> 返回上一级</a>
</p>
<div class="container">
 <div class="row">
          <div class="col-lg-8">
              <form id="defaultForm" method="post" class="form-horizontal" action="">
                  <div class="form-group">
                      <label class="col-lg-3 control-label">栏目标题</label>
                      <div class="col-lg-5">
                          <input type="text" class="form-control" name="catname" placeholder="栏目标题" />
                      </div>
                    
                  </div>

                  <div class="form-group">
                      <label class="col-lg-3 control-label">URL链接</label>
                      <div class="col-lg-5">
                          <input type="text" class="form-control" name="url" placeholder="只限字母组成,格式如:ad/show" />
                      </div>
                  </div>

    <div class="form-group">

        <label class="col-lg-3 control-label">
        导航是否显示</label>
        <div class="col-lg-5">
        <input type="checkbox"  checked  onchange="gcheck('g_title');" id="g_title"  class="fchen_control" data-size="small" />
        </div>
    </div>
                 <div class="form-group">
                     <label class="col-lg-3 control-label">排序权重</label>
                     <div class="col-lg-5">
                         <input type="number" class="form-control" name="displayorder" step="1"
                                min="0" data-bv-greaterthan-inclusive="false" data-bv-greaterthan-message="最小排序为1"
                                max="100" data-bv-lessthan-inclusive="true" data-bv-lessthan-message="最大排序为100"
                                 />
                         <!--<input type="range" class="form-control" name="age"
                                required
                                min="10" max="100" data-bv-between-message="The input must be between 10 and 100"
                                 />-->
                     </div>
                 </div>
                  <div class="form-group">
                      <div class="col-lg-9 col-lg-offset-3">
                          <button type="submit" class="btn btn-primary" name=" " value="Sign up">添加</button>
                      </div>
                  </div>
                  <input type="hidden" name="upid" value="0">
                  <input type="hidden" name="status" class="status" value="1">
              </form>
          </div>
      </div>
</div>

<script type="text/javascript">
function gcheck(a){
        var a;
        var $aa = $("#"+a);
            //console.log($aa.is(":checked"));  //调试代码
        if($aa.is(":checked")==true){
            $('.status').val(1);
        }else{
 
            $('.status').val(0);
        }
    }
$("#g_title").bootstrapSwitch();
$(document).ready(function() {
    $('#defaultForm').bootstrapValidator({
        message: 'This value is not valid',
        container: 'tooltip',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            catname: {

                group: '.col-lg-5',
                validators: {
                    notEmpty: {
                        message: '标题不能为空'
                    }
                }
            },
          
            displayorder:{ group: '.col-lg-5',
                validators: {
                  notEmpty: {
                          message: '不能为空！'
                      },
                  stringLength: {
                          min: 1,
                          max: 2,
                          message: '长度必须在2个字符以内！'
                      },
                }
            },
            url: {
                message: 'The username is not valid',
                validators: {
                    notEmpty: {
                        message: '不能为空！'
                    },
                    stringLength: {
                        min: 2,
                        max: 30,
                         
                        message: '长度2-30位'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z_\.]+$/,
                        message: '请输入合法字母'
                    }
                   
                }
            },
           
         
            gender: {
                validators: {
                    notEmpty: {
                        message: 'The gender is required'
                    }
                }
            }
        }
    });
});
</script>
{/block}